<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="row">
    <input type="text" id="col">
    <input type="button" id="btn" value="生成">
    <table border="1" id="table"></table>
</body>
<script>
    var row=document.getElementById("row");
    var col=document.getElementById("col");
    var btn=document.getElementById("btn");
    var table=document.getElementById("table");
    btn.onclick=function(){
        var r=row.value-0;
        var c=col.value*1;
        var str="";
        for(var i=0;i<r;i++){
            var tds="";
            for(var j=0;j<c;j++){
                tds+="<td>"+i+"-"+j+"</td>";
            }
            str+="<tr>"+tds+"</tr>";
        }
        table.innerHTML=str;
        }
</script>
</html>